-
-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add radioactive chunk miche and make AI to use and omit radioactive chunks #5867
base: master
Are you sure you want to change the base?
Conversation
Didn't test, but the code all checks out Auto-Evo wise |
@@ -497,6 +510,16 @@ private void ChooseActions(in Entity entity, ref MicrobeAI ai, ref CompoundAbsor | |||
// There is no reason to be engulfing at this stage | |||
control.SetStateColonyAware(entity, MicrobeState.Normal); | |||
|
|||
// If the microbe has radiation protection it means it has melanosomes and can stay near tha radioactive chunks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the comment
return false; | ||
} | ||
|
||
var oppositeDirection = position.Position + (position.Position - chosenChunk.Value.Position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be normalized and then multiplied by a certain distance? I think that this math may end up picking a point really near if the distance between the chunk and the current position gets too low.
} | ||
|
||
// If the microbe is close to the chunk it doesn't need to go any closer | ||
if (position.Position.DistanceSquaredTo(chosenChunk.Value.Position) < 700.0f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a slight bit of randomness in the distance could be used here to make cells not always stop at an exact distance away from a chunk? (the microbe AI should already have access to a random instance that is fetched for each entity)
return; | ||
|
||
foreach (ref readonly var chunk in chunksSet.GetEntities()) | ||
lock (terrainChunkDataCache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this second level of locking is unnecessary and could be replaced with a comment like:
// As the chunk lock is always held when building all of the chunk caches, the other individual cache objects don't need separate locks to protect them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is already in very good shape but I had a few small technical comments on the code (I haven't playtested).
{ | ||
// Ignore already despawning chunks | ||
ref var timed = ref chunk.Get<TimedLife>(); | ||
if (chunk.Has<TimedLife>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new code? Is this really that useful to add here? This means that relatively the chunk cache will take quite a bit longer to build. And my hunch is that this doesn't help much as it takes just a few seconds for chunks to dissolve, so microbes don't see that many disappearing chunks even without this check.
Brief Description of What This PR Does
Here's the link to the test save where there are some species that have melanosomes: https://dev.revolutionarygamesstudio.com/files/Public/Testing%20Resources/Saves/Radioactive%20Chunk%20AI%20Test%20Save.thrivesave
Related Issues
Closes #5857
Closes #5855
Closes #5856
Progress Checklist
Note: before starting this checklist the PR should be marked as non-draft.
break existing features:
https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
(this is important as to not waste the time of Thrive team
members reviewing this PR)
styleguide.
Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.